package com.example.mobifin_busticket.views.activities;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Set;

import com.example.mobifin_busticket.AppData;
import com.example.mobifin_busticket.BusTicketManagaer;
import com.example.mobifin_busticket.R;
import com.example.mobifin_busticket.R.id;
import com.example.mobifin_busticket.R.layout;
import com.example.mobifin_busticket.R.menu;
import com.example.mobifin_busticket.Util;
import com.example.mobifin_busticket.controller.callbacks.ResponseListener;
import com.example.mobifin_busticket.controller.databasemanager.DatabaseManager;
import com.example.mobifin_busticket.models.BusModel;
import com.example.mobifin_busticket.models.SeatDetailsModel;
import com.example.mobifin_busticket.views.adapter.CustomListAdapterForTrips;
import com.example.mobifin_busticket.views.adapter.CustommenuListAdapter;
import com.example.mobifin_busticket.views.dialogs.CancelTicketDialog;
import com.example.mobifin_busticket.views.dialogs.CancellationPolicyDialog;
import com.example.mobifin_busticket.views.dialogs.Dialog_SelectDate;
import com.example.mobifin_busticket.views.dialogs.PrintTicketDialog;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;

import android.support.v7.app.ActionBarActivity;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.HorizontalScrollView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.ToggleButton;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.LinearLayout.LayoutParams;

public class SeatBoardingInfoActivity extends Activity implements
		OnClickListener {
	String busId, travelName, departureTime, arraivalTime, busType,
			strUpperLower = "Lower", farelist, seat, travelNameTime;
	int totalSeat;
	TextView tvTravelName, tvbusType, tvbusTime, tvTotalSeat,
			tvSelectedBoardingPoint, tvSelectedSeat, tvtotalFare;
	View seatView;
	LinearLayout ll_boardingPoint, ll_dynamivButton, ll_seat, ll_sleeperSeat,
			llError, llChildError;
	RelativeLayout seatLayout;
	Button btn_back, btn_continueBooking, btn_cancellationPolicy,
			btn_userSelectMenu;
	DateFormat avformat;
	ArrayList<SeatDetailsModel> seatList = null;
	Collection<SeatDetailsModel> sortSeat;
	ArrayList<String> upperlowerSeatLayout;
	ArrayList<String> ladiesSeatList;
	ToggleButton seatButton = null, sleeperButton = null;
	SeatDetailsModel seatModel;
	ListView MenuList;
	CustommenuListAdapter listAdapter;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_seat_boarding_info);
		Bundle mbundel = new Bundle();
		avformat = new SimpleDateFormat("yyyy-MM-dd hh:mm a");
		tvTravelName = (TextView) findViewById(R.id.tvTravelName);
		tvbusType = (TextView) findViewById(R.id.tvBusType);
		tvbusTime = (TextView) findViewById(R.id.tvBusTime);
		tvTotalSeat = (TextView) findViewById(R.id.tvTotaiseat);
		tvSelectedBoardingPoint = (TextView) findViewById(R.id.tv_SelectedPoint);
		tvSelectedSeat = (TextView) findViewById(R.id.tvSelectedseat);
		tvtotalFare = (TextView) findViewById(R.id.tvTotalfare);
		btn_back = (Button) findViewById(R.id.header_back_btn_in_seat);
		btn_continueBooking = (Button) findViewById(R.id.btnContinuebooking);
		btn_cancellationPolicy = (Button) findViewById(R.id.cancel_policy);
		ll_boardingPoint = (LinearLayout) findViewById(R.id.ll_boardingpoint);
		ll_seat = (LinearLayout) findViewById(R.id.ll_taptoSelectseat);
		ll_sleeperSeat = (LinearLayout) findViewById(R.id.ll_slepper);
		llError = (LinearLayout) findViewById(R.id.ll_error);
		llChildError = (LinearLayout) findViewById(R.id.ll_child_error);
		seatLayout = (RelativeLayout) findViewById(R.id.rltaptoSelectseat);
		seatView = (View) findViewById(R.id.view_Tap);
		btn_userSelectMenu = (Button) findViewById(R.id.btn_userSelectMenuinSeat);
		MenuList = (ListView) findViewById(R.id.list);
		btn_userSelectMenu.setOnClickListener(this);

		upperlowerSeatLayout = new ArrayList<String>();
		ladiesSeatList = new ArrayList<String>();
		btn_back.setOnClickListener(this);
		seatView.setOnClickListener(this);
		btn_continueBooking.setOnClickListener(this);
		btn_cancellationPolicy.setOnClickListener(this);
		llError.setOnClickListener(this);
		ll_seat.setOnClickListener(this);
		ll_boardingPoint.setOnClickListener(this);
		seatLayout.setOnClickListener(this);
		mbundel = getIntent().getExtras();
		busId = mbundel.getString("BusId");
		travelName = mbundel.getString("TravelName");
		busType = mbundel.getString("BusType");
		departureTime = mbundel.getString("DepartureTime");
		arraivalTime = mbundel.getString("ArrivalTime");
		totalSeat = mbundel.getInt("totalSeat");
		tvTravelName.setText(travelName);
		tvbusType.setText(busType);
		tvTotalSeat.setText(totalSeat + " " + "seat available");
		getAdapterArrivalTimewithFormat();
		getDepartureTimewithFormat();
		tvbusTime.setText(departureTime + "-" + arraivalTime);
		seatLayout();

		ArrayList<String> listValue = new ArrayList<String>();
		listValue.add(getResources().getString(R.string.cancel_ticket));
		listValue.add(getResources().getString(R.string.print_ticket));
		listAdapter = new CustommenuListAdapter(SeatBoardingInfoActivity.this,
				R.layout.custom_menu_list, listValue);
		MenuList.setAdapter(listAdapter);
		MenuList.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {
				// TODO Auto-generated method stub
				onMenuItemClick(position);
			}
		});

	}

	protected void onMenuItemClick(int position) {
		// TODO Auto-generated method stub
		if (position == 0) {
			System.out.println("on click Cancle");
			CancelTicketDialog dialog = new CancelTicketDialog(
					SeatBoardingInfoActivity.this);
			dialog.show();
			Util.mListHide(MenuList);
		}
		if (position == 1) {
			System.out.println("on click print");
			PrintTicketDialog pdialog = new PrintTicketDialog(
					SeatBoardingInfoActivity.this);
			pdialog.show();
			Util.mListHide(MenuList);
		}
	}

	@SuppressLint("NewApi")
	private void seatLayout() {
		// TODO Auto-generated method stub
		ResponseListener fetchAllTripsListener = new ResponseListener() {

			@Override
			public void onResponse(Object seatListresonse) {
				// printData(busListresonse);
				seatList = (ArrayList<SeatDetailsModel>) seatListresonse;
				AppData.SeatList = seatList;
				for (int i = 0; i < seatList.size(); i++) {
					System.out.println("-------------------" + i
							+ "seat---------------");
					System.out.println("Available:"
							+ seatList.get(i).isAvailableSeat());
					System.out.println("BaseFare:"
							+ seatList.get(i).getBaseFare());
					System.out.println("Column:" + seatList.get(i).getColumn());
					System.out.println("fare:" + seatList.get(i).getFare());
					System.out.println("LadiesSeat:"
							+ seatList.get(i).isLadiesSeat());
					System.out.println("length:" + seatList.get(i).getLength());
					System.out.println("name:" + seatList.get(i).getName());
					System.out.println("row:" + seatList.get(i).getRow());
					System.out.println("ServicetaxAb"
							+ seatList.get(i).getServiceTaxAbsolute());
					System.out.println("Searvicetaxper:"
							+ seatList.get(i).getServiceTaxPercentage());
					System.out.println("zindex:" + seatList.get(i).getzIndex());

				}
				seatResponse();

			}

		};

		BusTicketManagaer busticketManager = new BusTicketManagaer();
		busticketManager.getAllSeatDetails(SeatBoardingInfoActivity.this,
				fetchAllTripsListener, AppData.CONSUMERKEY, AppData.SECRETKEY,
				AppData.BASESEATURL + "/tripdetails?id=" + busId, "TRIPS");

	}

	private void seatResponse() {
		// TODO Auto-generated method stub
		if (seatList != null) {
			ll_sleeperSeat.removeAllViews();
			ll_seat.removeAllViews();
			Multimap<Integer, SeatDetailsModel> lowerSeatLayout = getSeatLayout(
					seatList, 0);
			drawSeatLayout(lowerSeatLayout);
		}
	}

	public void drawSeatLayout(Multimap<Integer, SeatDetailsModel> seatMap) {
		int size = seatMap.size();
		System.out.println("map size:" + size);
		Set<Integer> keys = seatMap.keySet();
		List<Integer> list = new ArrayList<Integer>(keys);
		for (int i = getMinValue((ArrayList<Integer>) list); i <= getMaxValue((ArrayList<Integer>) list); i++) {
			sortSeat = seatMap.get(i);

			Collections.sort((List<SeatDetailsModel>) sortSeat,
					new Comparator<SeatDetailsModel>() {

						@Override
						public int compare(SeatDetailsModel arg0,
								SeatDetailsModel arg1) {
							// TODO Auto-generated method stub
							return (int) (arg0.getColumn() - arg1.getColumn());

						}

					});
			System.out.println("============Printing seat for Row " + i);
			System.out.println("============Row " + i + " seats size:"
					+ sortSeat.size());

			ll_seat.setPadding(10, 10, 10, 10);
			ll_dynamivButton = new LinearLayout(this);
			ll_dynamivButton.setOrientation(LinearLayout.HORIZONTAL);
			conditionBeforeseatlayout();
			for (final SeatDetailsModel seat : sortSeat) {
				System.out.println("no of rows" + i + "----->"
						+ seat.getColumn());
				seatButton = new ToggleButton(this);
				seatButton.setText("");
				seatButton.setTextOff(null);
				seatButton.setTextOn(null);
				LinearLayout.LayoutParams parms = new LinearLayout.LayoutParams(
						27, 22);

				parms.setMargins(1, 2, 2, 1);
				seatButton.setLayoutParams(parms);
				seatButton.setEnabled(false);

				if (seat.isAvailableSeat()) {
					getAvailableSeat(seat, seatButton);
				} else {
					getNonavailable(seat, seatButton);
				}System.out.println("===is checkd:===");
				isAlreadyChecked(seat);
				ll_dynamivButton.addView(seatButton);
				conditionforOrientation(seat);

			}
			ll_seat.addView(ll_dynamivButton);

		}

	}

	private void isAlreadyChecked(SeatDetailsModel s) {
		for (int i = 0; i < upperlowerSeatLayout.size(); i++) {
			System.out.println("seat name from isAlready Checke:"+s.getName());
			if (s.getName().toString().equals(upperlowerSeatLayout.get(i))) {
				seatButton.setChecked(true);
				onsetButtonBackground();
				Log.d("setchekcedTrue", "checked");
			}
		}
	}

	private void onsetButtonBackground() {
		// TODO Auto-generated method stub
		if (seatModel.getLength() == 1 && seatModel.getWidth() == 1) {
			seatButton
					.setBackgroundResource(R.drawable.seat_layout_tab_nor_std);
		}
		if (seatModel.getLength() == 2 && seatModel.getWidth() == 1) {
			seatButton
					.setBackgroundResource(R.drawable.seat_layout_tab_long_std);
		}
		if (seatModel.getWidth() == 2 && seatModel.getLength() == 1) {
			sleeperButton
					.setBackgroundResource(R.drawable.seat_layout_tab_tall_std);
		}
	}

	private void conditionforOrientation(SeatDetailsModel seat) {
		// TODO Auto-generated method stub
		LinearLayout.LayoutParams paramsOre = new LinearLayout.LayoutParams(
				LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
		paramsOre.gravity = Gravity.RIGHT;
		ll_dynamivButton.setLayoutParams(paramsOre);

	}

	private void conditionBeforeseatlayout() {
		if (sortSeat.isEmpty()) {
			LinearLayout.LayoutParams layoutParams1 = new LinearLayout.LayoutParams(
					LinearLayout.LayoutParams.WRAP_CONTENT,
					LinearLayout.LayoutParams.WRAP_CONTENT);
			ll_dynamivButton.setLayoutParams(layoutParams1);
			Button btnForSpace = new Button(this);
			btnForSpace.setText(" ");
			btnForSpace.setVisibility(View.INVISIBLE);
			ll_dynamivButton.addView(btnForSpace);
		}
	}

	private void getNonavailable(SeatDetailsModel seat, ToggleButton seatButton) {
		// TODO Auto-generated method stub
		if (seat.getLength() == 1 && seat.getWidth() == 1) {

			seatButton
					.setBackgroundResource(R.drawable.seat_layout_tab_nor_bkd);

		}
		if (seat.getLength() == 2 && seat.getWidth() == 1) {
			LinearLayout.LayoutParams layoutParams1 = new LinearLayout.LayoutParams(
					56, 24);
			layoutParams1.setMargins(2, 2, 2, 2);
			seatButton.setLayoutParams(layoutParams1);
			seatButton
					.setBackgroundResource(R.drawable.seat_layout_tab_long_bkd);
		}
		getSleeperSeat(seat, seatButton);
	}

	private void getAvailableSeat(SeatDetailsModel availableSeat,
			ToggleButton seatbutton) {
		if (availableSeat.getLength() == 1 && availableSeat.getWidth() == 1) {
			if (availableSeat.isLadiesSeat()) {
				seatButton
						.setBackgroundResource(R.drawable.seat_layout_tab_nor_lad_avl);
			} else {
				seatbutton
						.setBackgroundResource(R.drawable.seat_layout_tab_nor_avl);

			}
		}
		if (availableSeat.getLength() == 2 && availableSeat.getWidth() == 1) {
			if (availableSeat.isLadiesSeat()) {
				LinearLayout.LayoutParams layoutParams1 = new LinearLayout.LayoutParams(
						56, 24);
				layoutParams1.setMargins(2, 2, 2, 2);
				seatButton.setLayoutParams(layoutParams1);
				seatbutton
						.setBackgroundResource(R.drawable.seat_layout_tab_long_lad_avl);
			} else {
				LinearLayout.LayoutParams layoutParams1 = new LinearLayout.LayoutParams(
						56, 24);
				layoutParams1.setMargins(2, 2, 2, 2);
				seatButton.setLayoutParams(layoutParams1);
				seatButton
						.setBackgroundResource(R.drawable.seat_layout_tab_long_avl);
			}
		}
		getSleeperSeat(availableSeat, seatbutton);
	}

	private void getSleeperSeat(SeatDetailsModel availableSeat,
			ToggleButton seatbutton) {
		// TODO Auto-generated method stub
		if (availableSeat.getWidth() == 2 && availableSeat.getLength() == 1) {
			seatbutton.setVisibility(View.GONE);
			sleeperButton = new ToggleButton(this);
			sleeperButton.setText("");
			sleeperButton.setTextOff(null);
			sleeperButton.setTextOn(null);
			LinearLayout.LayoutParams parms = new LinearLayout.LayoutParams(30,
					50);
			parms.setMargins(2, 2, 2, 2);
			sleeperButton.setLayoutParams(parms);
			sleeperButton.setGravity(Gravity.CENTER);
			if (availableSeat.isAvailableSeat())
				if (availableSeat.isLadiesSeat()) {
					sleeperButton
							.setBackgroundResource(R.drawable.seat_layout_tab_tall_lad_avl);
				} else {
					sleeperButton
							.setBackgroundResource(R.drawable.seat_layout_tab_tall_avl);
				}
			else
				sleeperButton
						.setBackgroundResource(R.drawable.seat_layout_tab_tall_bkd);
			sleeperButton.setEnabled(false);
			ll_sleeperSeat.addView(sleeperButton);
		}

	}

	private Multimap<Integer, SeatDetailsModel> getSeatLayout(
			ArrayList<SeatDetailsModel> seatLIst, int index) {
		Multimap<Integer, SeatDetailsModel> map = ArrayListMultimap.create();
		for (int i = 0; i < seatLIst.size(); i++) {
			if (seatLIst.get(i).getzIndex() == index) {
				map.put(seatLIst.get(i).getRow(), seatLIst.get(i));
			}
		}
		System.out.println("map:" + map.toString());
		return map;

	}

	public int getMaxValue(ArrayList<Integer> seatList) {
		Integer maxlength = seatList.get(0);
		for (int i = 0; i < seatList.size(); i++) {
			if (seatList.get(i) > maxlength) {
				maxlength = seatList.get(i);
			}
		}
		return maxlength;
	}

	public int getMinValue(ArrayList<Integer> seatList) {
		Integer minlength = seatList.get(0);
		for (int i = 0; i < seatList.size(); i++) {
			if (seatList.get(i) < minlength) {
				minlength = seatList.get(i);
			}
		}
		return minlength;
	}

	private void getDepartureTimewithFormat() {

		Date departDate = null;
		try {
			departDate = avformat.parse("" + departureTime);
			DateFormat dateFormat = new SimpleDateFormat("hh:mm a");
			departureTime = dateFormat.format(departDate).toString();
		} catch (ParseException e) {
			e.printStackTrace();
		}
	}

	private void getAdapterArrivalTimewithFormat() {

		Date avDate = null;
		try {
			avDate = avformat.parse("" + arraivalTime);
			DateFormat avdateFormat = new SimpleDateFormat("hh:mm a");
			arraivalTime = avdateFormat.format(avDate).toString();
		} catch (ParseException e) {
			e.printStackTrace();
		}
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.header_back_btn_in_seat:
			Util.mListHide(MenuList);
			finish();
			break;
		case R.id.ll_boardingpoint:
			Util.mListHide(MenuList);
			onClickBoarding();
			break;
		case R.id.view_Tap:
			Util.mListHide(MenuList);
			onClickSeatLayout();
			break;
		case R.id.btnContinuebooking:
			Util.mListHide(MenuList);
			onClickbtnContinue();
			break;
		case R.id.cancel_policy:
			Util.mListHide(MenuList);
			onclickCancelltionpolicy();
		case R.id.ll_error:
			Util.mListHide(MenuList);
			llError.setVisibility(View.GONE);
		case R.id.btn_userSelectMenuinSeat:
			Util.onClickUserMenu(SeatBoardingInfoActivity.this, MenuList);
			break;
		default:
			break;
		}

	}

	private void onclickCancelltionpolicy() {
		// TODO Auto-generated method stub
		CancellationPolicyDialog calPolicy;
		try {
			calPolicy = new CancellationPolicyDialog(
					SeatBoardingInfoActivity.this, busId);
			calPolicy.show();
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

	private void onClickBoarding() {
		// TODO Auto-generated method stub
		Intent boardingIntent = new Intent(SeatBoardingInfoActivity.this,
				BoardingPointInfoActivity.class);
		boardingIntent.putExtra("Busid", busId);

		startActivityForResult(boardingIntent, 1);

	}

	private void onClickSeatLayout() {
		// TODO Auto-generated method stub
		Intent seatIntent = new Intent(SeatBoardingInfoActivity.this,
				SelectBusSeatActivity.class);
		seatIntent.putExtra("Busid", busId);
		seatIntent
				.putStringArrayListExtra("seatNameList", upperlowerSeatLayout);
		startActivityForResult(seatIntent, 2);
	}

	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		// TODO Auto-generated method stub
		super.onActivityResult(requestCode, resultCode, data);
		if (requestCode == 1 && resultCode == RESULT_OK) {
			String boardingPoint = data.getStringExtra("SelectBoarding");
			tvSelectedBoardingPoint.setText(boardingPoint);
		}
		if (requestCode == 2 && resultCode == RESULT_OK) {
			if (upperlowerSeatLayout != null) {
				upperlowerSeatLayout.clear();
			}
			if (ladiesSeatList != null) {
				ladiesSeatList.clear();
			}
			farelist = data.getStringExtra("retuenfarelList");
			seat = data.getStringExtra("retuenSeatnameList");
			String boarding = data.getStringExtra("returnBoardig");
			String upperLower = data.getStringExtra("strupperlower");

			upperlowerSeatLayout = data
					.getStringArrayListExtra("lowerSeatLayout");
			ladiesSeatList = data.getStringArrayListExtra("LadiesSeat");
			System.out.println("new list:" + upperlowerSeatLayout);

			System.out.println("new list in app data:" + AppData.SeatLayout);
			if (upperlowerSeatLayout != null) {
				upperlowerSeatLayout.clear();
			}

			tvtotalFare.setText(farelist);
			tvSelectedSeat.setText(seat);
			tvSelectedBoardingPoint.setText(boarding);
			if (upperLower.equals("Lower")) {
				ll_sleeperSeat.removeAllViews();
				ll_seat.removeAllViews();
				Multimap<Integer, SeatDetailsModel> lowerSeatLayout = getSeatLayout(
						seatList, 0);
				
				drawSeatLayout(lowerSeatLayout);

			} else {
				ll_sleeperSeat.removeAllViews();
				ll_seat.removeAllViews();
				Multimap<Integer, SeatDetailsModel> lowerSeatLayout = getSeatLayout(
						seatList, 1);
				isAlreadyChecked(seatModel);
				drawSeatLayout(lowerSeatLayout);

			}

		}
	}

	private void onClickbtnContinue() {
		// TODO Auto-generated method stub
		Animation slide = AnimationUtils.loadAnimation(getApplicationContext(),
				R.anim.slidedown);
		int noofField = 0;
		String errorMessage = "";
		if (tvSelectedSeat
				.getText()
				.toString()
				.equals((getResources()
						.getString(R.string.bus_no_seat_selected)))) {
			if (tvSelectedBoardingPoint

					.getText()
					.toString()
					.equals(getResources().getString(
							R.string.bus_selectboarding_point))) {
				llError.startAnimation(slide);
				llError.setVisibility(View.VISIBLE);
				noofField = 3;
				errorMessage = getResources().getString(
						R.string.bus_seerchbus_forget_title)
						+ ":"
						+ getResources().getString(R.string.bus_select_ur_seat)
						+ ":"
						+ getResources().getString(
								R.string.bus_select_ur_bpoint);
				Util.errorFieldcreationSeatselect(this, llChildError,
						noofField, errorMessage);
			} else {
				llError.startAnimation(slide);
				llError.setVisibility(View.VISIBLE);
				noofField = 2;
				errorMessage = getResources().getString(
						R.string.bus_seerchbus_forget_title)
						+ ":"
						+ getResources().getString(R.string.bus_select_ur_seat);
				Util.errorFieldcreationSeatselect(this, llChildError,
						noofField, errorMessage);
			}
		} else if (tvSelectedBoardingPoint
				.getText()
				.toString()
				.equals(getResources().getString(
						R.string.bus_selectboarding_point))) {
			llError.startAnimation(slide);
			llError.setVisibility(View.VISIBLE);
			noofField = 2;
			errorMessage = getResources().getString(
					R.string.bus_seerchbus_forget_title)
					+ ":"
					+ getResources().getString(R.string.bus_select_ur_bpoint);
			Util.errorFieldcreationSeatselect(this, llChildError, noofField,
					errorMessage);
		}

		else {
			travelNameTime = tvTravelName.getText().toString() + "\nat "
					+ tvSelectedBoardingPoint.getText().toString().trim();
			AppData.TravelBoarding = travelNameTime;
			Intent continueBooking = new Intent(SeatBoardingInfoActivity.this,
					ContactDetailsActivity.class);
			continueBooking.putExtra("totalFare", farelist);
			continueBooking.putStringArrayListExtra("LadiesSeatList",
					ladiesSeatList);
			System.out.println("list on continue:" + upperlowerSeatLayout);
			startActivity(continueBooking);
		}
	}
}
